package com.fr.report.script.function;

import com.fr.base.core.DateUtils;
import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;
import com.fr.report.script.Primitive;
import java.util.Date;

public class DAYVALUE extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    if (paramArrayOfObject.length < 1)
      return Primitive.ERROR_NAME;
    Date localDate = DateUtils.object2Date(paramArrayOfObject[0], false);
    return new Integer((int)(localDate.getTime() / 86400000.0D) + 25570);
  }

  public Function.Type getType()
  {
    return Function.DATETIME;
  }

  public String getCN()
  {
    return "DAYVALUE(date):返回1900年至 date日期所经历的天数。\n示例：\nDAYVALUE(\"2008/08/08\")等于39668。";
  }

  public String getEN()
  {
    return "";
  }
}